import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-11-12
 * Time: 19:44
 */
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String string = "";
        while (!string.equals("end")){
            string = sc.next();
            if (string.length()%3==0&&string.length()!=0&&!string.equals("end")){
                System.out.print(string+" ");
            }
        }
    }
}
